package com.mofum.msdom.excel.demo.convert;

import com.mofum.msdom.excel.converter.TypeConverter;

import java.lang.reflect.Type;
import java.math.BigDecimal;

/**
 * @author yuyang@qxy37.com
 * @since 2019/1/25 0025 13:47
 */
public class DemoConvert implements TypeConverter<String, Object> {
    @Override
    public Object convert(String str, Type type) {

        if (String.class.equals(type)) {
            return (String) str;
        }

        if (BigDecimal.class.equals(type)) {
            return new BigDecimal(str).setScale(2);
        }

        return null;
    }
}
